/*
 * ShubertFunction.cpp
 *
 *  Created on: 2010-01-13
 *      Author: adas
 */

#include <cmath>

#include "ShubertFunction.h"

double ShubertFunction::operator()(const Element & el)
{
	int n = el.getDimensionCount();

	double s = 1;
	double temp = 0;

	for(int i = 0; i < n; ++i)
	{
		for(int j = 1; j <= 5; ++j)
		{
			temp += j*cos( (j+1)*el.getValueAt(i) + j );
		}
		s *= temp;
		temp = 0;
	}

	return s;

}
